package com.micro.feign;

import java.math.BigDecimal;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import com.micro.dto.UserProfileDTO;

/**
 * 用户服务Feign客户端
 */
@FeignClient(name = "user-service")
public interface UserServiceFeign {

    /**
     * 获取用户档案
     */
    @GetMapping("/api/users/{userId}/profile")
    UserProfileDTO getUserProfile(@PathVariable("userId") Long userId);

    /**
     * 用户消费扣款
     */
    @PostMapping("/api/users/{userId}/deduct")
    void deductBalance(@PathVariable("userId") Long userId,
                       @RequestParam("amount") BigDecimal amount);
}